const AppSchema = {
  name: 'App',
  primaryKey: 'id',
  properties: {
    id: 'int',
    appName: { type: 'string', indexed: true },
    appId: { type: 'int', indexed: true },
    desc: { type: 'string' }
  }
}

const AutoIncAppId = params => {
  const realm = require('.')
  let apps = realm.objects('App').sorted('id', true)
  return apps.length > 0 ? apps[0].id + 1 : 1
}
module.exports = { AppSchema, AutoIncAppId }
